//
//  ZXIconDiscountButton.swift
//  loveBee
//
//  Created by zhangxing on 2017/8/14.
//  Copyright © 2017年 zhangXing. All rights reserved.
//

import UIKit

class ZXIconDiscountButton: UIButton {

    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.x = 0
        
        imageView?.y = 0
        
        imageView?.width = width
        //这里高度本来等于imageView的宽度,但是达不到我们想要的效果,我们在后面减去一个值进行了微调
        imageView?.height = (imageView?.width)! - 19
        
        titleLabel?.x = 0
        
        titleLabel?.y = (imageView?.height)! + 15
        
        titleLabel?.width = width
        
        titleLabel?.height = height! - width! - 8
    }
}
